﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace PasswordStrengthener
{
    using System.IO;

    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            if (e.Args.Length == 3)
            {
                string basePwd = e.Args[0];
                long iterations = int.Parse(e.Args[1]);
                int length = int.Parse(e.Args[2]);

                string result = Worker.Hash(basePwd, iterations);
                File.WriteAllText("password.txt", result.Substring(0, length));
            }
            else
            {
                new MainWindow().ShowDialog();
            }
            Shutdown();
        }
    }
}
